<script>
	export default {
		onLaunch: function() {
			var that = this;
			this.request.get({
				url:"index/index/getinfo",
				success:(res)=>{
					//console.log(res);
					if(res.statusCode==200){
						var appInfo = res.data;
						if(appInfo.screenImage){
							var screen = appInfo.screenImage;
							var screenImg = uni.getStorageInfoSync("screen_img");
							if(screenImg != screen.src){
								var downloadTask = uni.downloadFile({
								    url: screen.src, //仅为示例，并非真实接口地址。
								    success: (res)=> {
										uni.setStorageSync("screen_img",screen.src);
										uni.setStorageSync("splash_img",res.tempFilePath);
										uni.setStorageSync("splash_link",screen.link);
									}
								});
								//downloadTask.abort();
							}
						}
						var apiurl = appInfo.apiurl,byapiurl = appInfo.byapiurl;
						//var apiurl = "http://api.vipmisss.com:81/longtao/json.txt;http://api.vipmisss.com:81/longtao/",byapiurl="http://api.vipmisss.com:81/longtao/json.txt;http://api.vipmisss.com:81/longtao/";
						
						if(apiurl){
							apiurl = apiurl.split(";");
							if(apiurl.length == 2){
							  this.request.defaultApiUrl = apiurl[0];
							  this.request.defaultApiPath = apiurl[1];
							}
						}
						if(byapiurl){
							byapiurl = byapiurl.split(";");
							if(byapiurl.length == 2){
							  this.request.secondApiUrl = byapiurl[0];
							  this.request.secondApiPath = byapiurl[1];
							}
						}
						this.appInfo.setData(appInfo);
						//预加载频道信息
						this.request.getApiInfo((response)=>{	
							if(typeof response.data != 'undefined'){
							  that.appInfo.data.pinDaoList = response.data.pingtai;
							}
						},(error)=>{
							
						});
					}
				}
			});
		},
		onShow: function() {
			console.log('App Show');
			// 保持屏幕常亮
			uni.setKeepScreenOn({
			    keepScreenOn: true
			});
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>
